import { Chesstype, GameStatus } from "../types/enums";
import './GameStatusComp.css'

interface IProps {
  type: GameStatus
  next: Chesstype.red | Chesstype.blue
}

export function GameStatusComp(prop:IProps) {
  let text:JSX.Element;
  let {type, next} = prop
  if(type === GameStatus.gaming){
    if(next === Chesstype.red){
      text = <div className="next red">红方落子</div>
    }else{
      text = <div className="next blue">蓝方落子</div>
    }
  }else{
    if(type === GameStatus.redWin){
      text = <div className="win red">红方胜利</div>
    }else if(type === GameStatus.blueWin){
      text = <div className="win red">蓝方胜利</div>
    }else{
      text = <div className="win">平局</div>
    }
  }
  return (
    <div className="gameStatus">{text}</div>
  )
}